/*
Copyright (c) [2019年5月1日] [吴超]
[MBT_studio] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
		 http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
#pragma once

#include "UI/Widget.h"
#include "UI/ui绘制模板.h"
#include "UI/布局.h"


class C_行编辑框 : public C_文本框 {
	
public:
	C_行编辑框(S_UI创建环境& ctx, const S_Props& prop = {});
	~C_行编辑框();

	S_Props m_Value;

	ui_绘制模板_画预设图形	m_框部件;
	ui_绘制模板_画预设图形	m_光标绘制;
	ui_绘制模板_行文本绘制	m_字符绘制;
	uvec2	m_图元;


			void	f_绑定事件重置();
	virtual bool	f_使用子类拖放事件();

	void	f_set光标();
	void	f_开启输入();
	void	f_set对齐偏移();
	void	f_输入完成();
	void	f_Copy();
	void	f_set插入文本(std::vector<std::wstring> texts);
};

//bool f_行编辑框开启编辑(C_Widget* self, const E_鼠标按钮& 按钮);
bool f_行编辑框_控制键输入(C_文本框* self, const S_键盘& ks);

vec2 f_行编辑框_计算光标位置(C_文本框* self, float32 文字间隔);

void f_行编辑框_Ascii文本输入(C_行编辑框* box, const S_键盘& ks);
void f_行编辑框_输入法文本输入(C_行编辑框* box, const S_键盘& ks);
void f_行编辑框_退回字符(C_行编辑框* box);
bool f_行编辑框_删除选取(C_行编辑框* box);





class C_文本编辑框 : public C_文本框 {
	

public:
	C_文本编辑框(S_UI创建环境& ctx, std::string 字体名称);
	~C_文本编辑框();

	//fp_Widget更新	mf_框选时回调;
	//fp_Widget更新	mf_框选后回调;

	void	f_插入字符(wchar_t t, ivec2 pos);
	void	f_删除字符(ivec2 pos);
	void	f_插入行(uint32 pos);
	void	f_删除行(uint32 pos);
	void	f_删除字符();

	void	f_添加行大小(uint32 num);
	void	f_减少行大小(uint32 num);
	void	f_set光标();
	void	f_set插入文本(std::vector<std::wstring> texts);
	void	f_Copy();
	void	f_粘贴();
	//void	f_字符相关输入(wchar_t 当前输入);
};



void f_edit_删除选取文本(C_文本框* 文本框);

